Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use 'fallback simulator' for tvOS #2608

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

cgoldsby
Copy link
Contributor

@cgoldsby cgoldsby commented Feb 20, 2025

Summary

👋, I am working on adding OOT (Out-of-tree) CLI support to react-native-tvos. The update went well, and the OOT will soon have build-, run- , and log- commands for tvos.

However, the wrong simulator is selected.

This bug is unique to the tvos platform. When passing the --simulator parameter, the first device is always chosen, and the simulator parameter is ignored.

tl;dr
The wrong simulator is selected when the platform is tvos.

Test Plan

While the fix is straightforward, testing takes a little setup. I created a sample RNTV project for testing and validating this change.

Pre-requisites
Xcode is installed, and at least two simulators are installed. The trick to reproducing the issue is to select a simulator that is not first in the device list.

In this example, I have two simulators installed and one device connected:
(order from --list-devices)

  • Office (18.3)
  • Apple TV 4K (17.4)
  • Apple TV (17.0)

I will try to run the app on the Apple TV (17.0) simulator.

Step to reproduce

  1. gh repo clone cgoldsby/react-native-tvos
  2. cd react-native-tvos
  3. git checkout oot-tvos-rntester
  4. git clean -xdf
  5. yarn
  6. (cd packages/rn-tester ; bundle i ; bundle exec pod install)
  7. (cd packages/rn-tester ; npx react-native run-tvos --scheme RNTester --simulator 'Apple TV (17.0)')
info A dev server is already running for this project on port 8081.
info Found Xcode workspace "RNTesterPods.xcworkspace"
info Launching Office (18.3 (22K557)) // ❌ Wrong simulator is selected. CLI selected first device. Apple TV simulator was expected.
info Building (using "xcodebuild -workspace RNTesterPods.xcworkspace -configuration Debug -scheme RNTester -destination id=2be85da36966f6284f2325c55023e39884a39209")

Expected
info Launching Apple TV (tvOS 17.0)

Actual
info Launching Office (18.3 (22K557))

Testing the FIX
We'll continue and test the fix by rerunning yarn with the patched file.

  1. PATCH=true yarn
  2. (cd packages/rn-tester ; npx react-native run-tvos --scheme RNTester --simulator 'Apple TV (17.0)')
info A dev server is already running for this project on port 8081.
info Found Xcode workspace "RNTesterPods.xcworkspace"
info Launching Apple TV (tvOS 17.0) // ✅ The correct simulator was selected
info Building (using "xcodebuild -workspace RNTesterPods.xcworkspace -configuration Debug -scheme RNTester -destination id=3D7F6892-1820-48B5-84BF-240D821C8986")

After the patch, the correct simulator, Apple TV (tvOS 17.0), was selected.

Checklist

  • Documentation is up to date.
  • Follows commit message convention described in CONTRIBUTING.md.
  • For functional changes, my test plan has linked these CLI changes into a local react-native checkout (instructions).

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Any pointers to where you work on oot tvos support? :)

@cgoldsby
Copy link
Contributor Author

cgoldsby commented Feb 20, 2025

Thanks! Any pointers to where you work on oot tvos support? :)

The oot tvos work is done in my react-native-tvos fork.
Branch:
feature/oot-cli-commands
Specific commit:
cgoldsby/react-native-tvos@052568c

For this PR, I created a branch for testing:
https://github.com/cgoldsby/react-native-tvos/tree/oot-tvos-rntester

But, if you are asking where I work: Zattoo, Inc.

@thymikee
Copy link
Member

Lovely! I see you’re using official api, this is going to make things so much easier. Hope Doug is onboard. Please feel free to tag me on the PR to the tvos codebase :)

@thymikee
Copy link
Member

One linter error to go and we're good here 👍🏼

@thymikee thymikee merged commit 23d9a1a into react-native-community:main Feb 21, 2025
4 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants